3.38 \(\int \frac{\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx\)

Optimal. Leaf size=67 \[ -\frac{A+i B}{2 a d (1+i \tan (c+d x))}-\frac{x (-B+i A)}{2 a}+\frac{i B \log (\cos (c+d x))}{a d} \]

[Out]

-((I*A - B)*x)/(2*a) + (I*B*Log[Cos[c + d*x]])/(a*d) - (A + I*B)/(2*a*d*(1 + I*Tan[c + d*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.093083, antiderivative size = 67, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 32, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.156, Rules used = {3589, 3475, 12, 3526, 8} \[ -\frac{A+i B}{2 a d (1+i \tan (c+d x))}-\frac{x (-B+i A)}{2 a}+\frac{i B \log (\cos (c+d x))}{a d} \]

Antiderivative was successfully verified.

[In]

Int[(Tan[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

-((I*A - B)*x)/(2*a) + (I*B*Log[Cos[c + d*x]])/(a*d) - (A + I*B)/(2*a*d*(1 + I*Tan[c + d*x]))

Rule 3589

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[(B*d)/b, Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3526

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^m)/(2*a*f*m), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \frac{\tan (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx &=-\frac{i \int \frac{a (i A-B) \tan (c+d x)}{a+i a \tan (c+d x)} \, dx}{a}-\frac{(i B) \int \tan (c+d x) \, dx}{a}\\ &=\frac{i B \log (\cos (c+d x))}{a d}-(-A-i B) \int \frac{\tan (c+d x)}{a+i a \tan (c+d x)} \, dx\\ &=\frac{i B \log (\cos (c+d x))}{a d}-\frac{A+i B}{2 d (a+i a \tan (c+d x))}-\frac{(i A-B) \int 1 \, dx}{2 a}\\ &=-\frac{(i A-B) x}{2 a}+\frac{i B \log (\cos (c+d x))}{a d}-\frac{A+i B}{2 d (a+i a \tan (c+d x))}\\ \end{align*}

Mathematica [B]  time = 0.918988, size = 148, normalized size = 2.21 \[ \frac{\cos (c+d x) (A+B \tan (c+d x)) \left (\tan (c+d x) \left (-2 i A d x+A+2 i B \log \left (\cos ^2(c+d x)\right )-2 B d x+i B\right )-2 A d x+i A+4 B \tan ^{-1}(\tan (d x)) (\tan (c+d x)-i)+2 B \log \left (\cos ^2(c+d x)\right )+2 i B d x-B\right )}{4 a d (\tan (c+d x)-i) (A \cos (c+d x)+B \sin (c+d x))} \]

Antiderivative was successfully verified.

[In]

Integrate[(Tan[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

(Cos[c + d*x]*(A + B*Tan[c + d*x])*(I*A - B - 2*A*d*x + (2*I)*B*d*x + 2*B*Log[Cos[c + d*x]^2] + (A + I*B - (2*
I)*A*d*x - 2*B*d*x + (2*I)*B*Log[Cos[c + d*x]^2])*Tan[c + d*x] + 4*B*ArcTan[Tan[d*x]]*(-I + Tan[c + d*x])))/(4
*a*d*(A*Cos[c + d*x] + B*Sin[c + d*x])*(-I + Tan[c + d*x]))

________________________________________________________________________________________

Maple [A]  time = 0.027, size = 121, normalized size = 1.8 \begin{align*} -{\frac{\ln \left ( \tan \left ( dx+c \right ) -i \right ) A}{4\,ad}}-{\frac{{\frac{3\,i}{4}}\ln \left ( \tan \left ( dx+c \right ) -i \right ) B}{ad}}+{\frac{{\frac{i}{2}}A}{ad \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{B}{2\,ad \left ( \tan \left ( dx+c \right ) -i \right ) }}+{\frac{A\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{4\,ad}}-{\frac{{\frac{i}{4}}B\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{ad}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)

[Out]

-1/4/d/a*ln(tan(d*x+c)-I)*A-3/4*I/d/a*ln(tan(d*x+c)-I)*B+1/2*I/d/a/(tan(d*x+c)-I)*A-1/2/d/a/(tan(d*x+c)-I)*B+1
/4/d/a*A*ln(tan(d*x+c)+I)-1/4*I/d/a*B*ln(tan(d*x+c)+I)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.55483, size = 189, normalized size = 2.82 \begin{align*} \frac{{\left ({\left (-2 i \, A + 6 \, B\right )} d x e^{\left (2 i \, d x + 2 i \, c\right )} + 4 i \, B e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - A - i \, B\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{4 \, a d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/4*((-2*I*A + 6*B)*d*x*e^(2*I*d*x + 2*I*c) + 4*I*B*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - A - I*B
)*e^(-2*I*d*x - 2*I*c)/(a*d)

________________________________________________________________________________________

Sympy [A]  time = 4.19816, size = 114, normalized size = 1.7 \begin{align*} \frac{i B \log{\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a d} - \frac{\left (\begin{cases} i A x e^{2 i c} + \frac{A e^{- 2 i d x}}{2 d} - 3 B x e^{2 i c} + \frac{i B e^{- 2 i d x}}{2 d} & \text{for}\: d \neq 0 \\x \left (i A e^{2 i c} - i A - 3 B e^{2 i c} + B\right ) & \text{otherwise} \end{cases}\right ) e^{- 2 i c}}{2 a} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)

[Out]

I*B*log(exp(2*I*d*x) + exp(-2*I*c))/(a*d) - Piecewise((I*A*x*exp(2*I*c) + A*exp(-2*I*d*x)/(2*d) - 3*B*x*exp(2*
I*c) + I*B*exp(-2*I*d*x)/(2*d), Ne(d, 0)), (x*(I*A*exp(2*I*c) - I*A - 3*B*exp(2*I*c) + B), True))*exp(-2*I*c)/
(2*a)

________________________________________________________________________________________

Giac [A]  time = 1.44311, size = 111, normalized size = 1.66 \begin{align*} -\frac{\frac{{\left (A + 3 i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a} - \frac{{\left (A - i \, B\right )} \log \left (i \, \tan \left (d x + c\right ) - 1\right )}{a} - \frac{A \tan \left (d x + c\right ) + 3 i \, B \tan \left (d x + c\right ) + i \, A + B}{a{\left (\tan \left (d x + c\right ) - i\right )}}}{4 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/4*((A + 3*I*B)*log(tan(d*x + c) - I)/a - (A - I*B)*log(I*tan(d*x + c) - 1)/a - (A*tan(d*x + c) + 3*I*B*tan(
d*x + c) + I*A + B)/(a*(tan(d*x + c) - I)))/d